home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / mail / mailpgp < prev    next >
Text File  |  1996-11-17  |  2KB  |  57 lines

  1. #!/usr/bin/perl
  2.  
  3. # written by jason steiner, jsteiner@anwsun.phya.utoledo.edu, Jan 1993
  4. #
  5. # Modified and fixed by Dave Arcuri (tfff@grove.iup.edu)
  6. #   April 19, 1996
  7. #
  8. # mailpgp  (Perl 5 script)
  9. # -  MailPGP provides a simple, seamless (?) interface to use PGP
  10. #    encryption directly from with a UNIX mailer such
  11. #    as Elm (maybe Pine, although I've only tested it on Elm.)
  12. # -  To recieve the functionality of automatic encryption in your
  13. #    mail program (read: Elm,) change your editor (from 'O'ptions) to
  14. #    /path/where/you/put/this/mailpgp
  15. #    Bingo. You're all set.
  16.  
  17. ($visual = $ENV{'VISUAL'}) || ($visual = '/usr/bin/vi');
  18. print "Use PGP (Y/n): ";
  19. $q=<STDIN>;
  20. chop $q;
  21. if (($q eq 'Y') || ($q eq 'y') || ($q eq '')) { $dopgp = 1; }
  22. else { $dopgp = 0; }
  23. $q='';
  24. system($visual,@ARGV);
  25. if ($dopgp) {
  26.     while (!$q) {
  27.             print "Sign this message? [Y]: ";
  28.             $q=<STDIN>;
  29.             chop $q;
  30.             if (($q eq 'Y') || ($q eq 'y') || ($q eq '')) {
  31.                     push(@opts,'-st','+clearsig=on');
  32.                     $q="y";
  33.                     }
  34.             elsif (($q ne 'N') && ($q ne 'n')) {
  35.                     $q='';
  36.             }
  37.     }
  38.     $q='';
  39.     while (!$q) {
  40.             print "Encrypt this message? [Y]: ";
  41.             $q=<STDIN>;
  42.             chop $q;
  43.             if (($q eq 'Y') || ($q eq 'y') || ($q eq '')) {
  44.                     push(@opts,'-e');
  45.                     $q="y";
  46.                     }
  47.             elsif (($q ne 'N') && ($q ne 'n')) {
  48.                     $q='';
  49.             }
  50.     }
  51. } #endif dopgp
  52. if (@opts) {
  53.         $name=$ARGV[$#ARGV];
  54.         system('pgp','-a',@opts,$name);
  55.         system "mv ${name}.asc $name";
  56. }
  57.